# -*- coding:utf-8 -*-

# break 的用法
# 当循环执行到break, 会终止整个循环

# num = 1
# while num <= 10:
#     print(f"今天正在刷第{num}辆")
#     if num == 5:
#         print("今天任务完成")
#         break
#     num += 1
#
# print("下班了")


# continue 的用法
# 当循环执行到continue, 会跳过当前循环

num = 1
while num <= 10:
    if num == 6:   # 条件判断，当num = 6时，打印遇到奔驰
        print("遇到奔驰了")

        # 这里加上一个num += 1为了使程序跳过6找到出口，
        # 否则程序会在num等于6时
        # 一直循环不会结束
        num += 1
        continue
    print(f"正在刷第{num}辆")
    num += 1
